#include "sys.h"
#include "ui_sys.h"

sys::sys(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::sys)
{
    ui->setupUi(this);
    setWindowFlags(Qt::Dialog);
    setFixedSize(528, 200);

}

sys::~sys()
{
    delete ui;
}

void sys::on_add_s_clicked()  //点击student的add按钮触发（后八个函数与此同构）
{
    this->hide();
    a.set_type(0);  //设置type为0，标记未修改student表
    a.setWindowTitle("add student");
    a.show();
    a.exec();
    this->show();
}

void sys::on_add_t_clicked()
{
    this->hide();
    a.set_type(1);
    a.setWindowTitle("add teacher");
    a.show();
    a.exec();
    this->show();
}

void sys::on_add_c_clicked()
{
    this->hide();
    a.set_type(2);
    a.setWindowTitle("add course");
    a.show();
    a.exec();
    this->show();
}

void sys::on_del_s_clicked()
{
    this->hide();
    del.set_type(0);
    del.setWindowTitle("delete student");
    del.show();
    del.exec();
    this->show();
}

void sys::on_del_t_clicked()
{
    this->hide();
    del.set_type(1);
    del.setWindowTitle("delete teacher");
    del.show();
    del.exec();
    this->show();
}

void sys::on_del_c_clicked()
{
    this->hide();
    del.set_type(2);
    del.setWindowTitle("delete course");
    del.show();
    del.exec();
    this->show();
}


void sys::on_show_s_clicked()
{
    this->hide();
    dis.set_type(0);
    dis.setWindowTitle("dispaly student list");
    dis.show();
    dis.exec();
    this->show();
}

void sys::on_show_t_clicked()
{
    this->hide();
    dis.set_type(1);
    dis.setWindowTitle("dispaly teacher list");
    dis.show();
    dis.exec();
    this->show();
}

void sys::on_show_c_clicked()
{
    this->hide();
    dis.set_type(2);
    dis.setWindowTitle("dispaly course list");
    dis.show();
    dis.exec();
    this->show();
}

void sys::on_actionalter_password_triggered()  //点击修改密码触发
{
    alt.set_type(1);
    alt.set_number("000");
    alt.show();
    this->close();
}
